#ifndef _TANKOBJECT_H_
#define _TANKOBJECT_H_

#include <engine.h>
#include <QGraphicsPixmapItem>
#include <QPixmap>
#include <QVector3D>

////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////
class Rocket : public GObject
{
public:
    Rocket(QString name);
    ~Rocket();

public slots:
	void	collisionRocket();

public:
    void    StopAnimate();
    void    RotateTo(int toX, int toY);

protected:
    virtual QRectF  boundingRect() const;
    virtual void    paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
	virtual void    CollisionDetected(void* param);
	virtual void	FinishedAnimation(QEvent::Type type, void* param);

private:
    QPixmap     m_image;
};

////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////
typedef std::list<Rocket*>              Rockets;
typedef std::list<Rocket*>::iterator    Rockets_itor;
class Tank : public GObject
{
public:
    Tank(QString name);
    ~Tank();

public:
    //void    StopAnimate();
    void    RotateAndMoveBodyTo(int toX, int toY);
    void    RotateTurretTo(int toX, int toY);

protected:
    virtual QRectF  boundingRect() const;
    virtual void    paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
    virtual void	FinishedAnimation(QEvent::Type type, void* param);
	
	void	MoveTank();
	void	Fire();

private:
	int					m_radiusTurret;
    Rockets				m_rockets;
    QGraphicsPixmapItem m_turret;
    QPixmap             m_body;
    QPoint              m_moveTo, m_fireTo;
};

////////////////////////////////////
// Target
////////////////////////////////////
class Target : public GObject
{
public:
    Target(QString name);
    ~Target();

public:
    void    RotateAndMoveBodyTo(int toX, int toY);
    void    RotateTurretTo(int toX, int toY);

protected:
    virtual QRectF  boundingRect() const;
    virtual void    paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);

private:
    QPixmap     m_image;
};

#endif // TANKOBJECT_H
